package org.example.enums;

/**
 * @ Author     ：hanxi
 * @ Date       ：Created in 22:38 2020/10/20
 * @ Description：支付渠道类型枚举
 */
public enum PaymentPayEnum {
    BALANCE(1, "余额", "balancePayFlag", "balancePaymentStrategy"),
    ALI_PAY(2, "支付宝", "aliPayFlag", "aliPayPaymentStrategy"),
    WE_CHAT(3, "微信", "weChatPayFlag", "weChatPaymentStrategy");
    /**
     * 支付渠道编号，对应支付渠道表中payChannel字段
     */
    private int id;

    /**
     * 支付渠道名称
     */
    private String name;

    /**
     * 支付渠道编码，用于前台APP页面开关判断
     */
    private String code;

    private String beanName;

    PaymentPayEnum(int id, String name, String code, String beanName) {
        this.id = id;
        this.name = name;
        this.code = code;
        this.beanName = beanName;
    }

    public static PaymentPayEnum getEnum(int id) {
        for (PaymentPayEnum paymentPayEnum : PaymentPayEnum.values()) {
            if (paymentPayEnum.getId() == id) {
                return paymentPayEnum;
            }
        }
        return null;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getCode() {
        return code;
    }

    public String getBeanName() {
        return beanName;
    }
}
